Fix 419737 - don't focus the file list when activating a shortcut in the file chooser
authorFederico Mena Quintero <federico@novell.com>
Tue, 12 Feb 2008 19:32:17 +0000 (19:32 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Tue, 12 Feb 2008 19:32:17 +0000 (19:32 +0000)
2008-02-12  Federico Mena Quintero  <federico@novell.com>

Merged from gtk-2-12:

Don't focus the file list when shortcuts get activated.  This
removes a lot of ambiguity in when the file selection should
change, and makes the overall code flow simpler.

This fixes http://bugzilla.gnome.org/show_bug.cgi?id=419737 -
file/save dialog clears the filename entry when changing
directories.

Also fixes http://bugzilla.gnome.org/show_bug.cgi?id=499940 -
focus should not go to the file list when a shortcut is activated.

* gtk/gtkfilechooserdefault.c
(shortcuts_activate_volume_mount_cb): Don't focus the file list
(shortcuts_activate_get_info_cb): Likewise.

* gtk/gtkfilechooserdefault.c (switch_to_shortcut): Don't focus
the file list (this was the last place where we would focus the
file list explicitly).  If you are in the location entry, for
example, you don't want Alt-Home to take you to the file list; you
just want the current folder to change.  Thanks to Olle Bergkvist
<olle.bergkvist@yahoo.se> for pointing this out in
http://bugzilla.gnome.org/show_bug.cgi?id=419737#c51.
(focus_browse_tree_view_if_possible): Removed.

Signed-off-by: Federico Mena Quintero <federico@gnu.org>
svn path=/trunk/; revision=19543

ChangeLog
gtk/gtkfilechooserdefault.c

index af26e385394b9c5cf4558359b17ab5519583555c..a701abe995e4a9cb0ca3435d62d235c70edf120d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2008-02-12  Federico Mena Quintero  <federico@novell.com>
+
+       Merged from gtk-2-12:
+
+       Don't focus the file list when shortcuts get activated.  This
+       removes a lot of ambiguity in when the file selection should
+       change, and makes the overall code flow simpler.
+
+       This fixes http://bugzilla.gnome.org/show_bug.cgi?id=419737 -
+       file/save dialog clears the filename entry when changing
+       directories.
+
+       Also fixes http://bugzilla.gnome.org/show_bug.cgi?id=499940 -
+       focus should not go to the file list when a shortcut is activated.
+
+       * gtk/gtkfilechooserdefault.c
+       (shortcuts_activate_volume_mount_cb): Don't focus the file list
+       (shortcuts_activate_get_info_cb): Likewise.
+
+       * gtk/gtkfilechooserdefault.c (switch_to_shortcut): Don't focus
+       the file list (this was the last place where we would focus the
+       file list explicitly).  If you are in the location entry, for
+       example, you don't want Alt-Home to take you to the file list; you
+       just want the current folder to change.  Thanks to Olle Bergkvist
+       <olle.bergkvist@yahoo.se> for pointing this out in
+       http://bugzilla.gnome.org/show_bug.cgi?id=419737#c51.
+       (focus_browse_tree_view_if_possible): Removed.
+
 2008-02-12  Matthias Clasen  <mclasen@redhat.com>
 
        Skip exensions when selecting filenames in the save-as dialog.
index 31978312f4bf243bb79c564989877fa184081a2c..d45043b33345900accb624811c732e1d01d7affe 100644 (file)
@@ -8200,23 +8200,6 @@ should_respond_after_confirm_overwrite (GtkFileChooserDefault *impl,
     }
 }
 
-/* Gives the focus to the browse tree view only if it is visible */
-static void
-focus_browse_tree_view_if_possible (GtkFileChooserDefault *impl)
-{
-  gboolean do_focus;
-
-  if ((impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
-       impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
-      && !gtk_expander_get_expanded (GTK_EXPANDER (impl->save_expander)))
-    do_focus = FALSE;
-  else
-    do_focus = TRUE;
-
-  if (do_focus)
-    gtk_widget_grab_focus (impl->browse_files_tree_view);
-}
-
 static void
 action_create_folder_cb (GtkFileSystemHandle *handle,
                         const GtkFilePath   *path,
@@ -10315,7 +10298,6 @@ shortcuts_activate_volume_mount_cb (GtkFileSystemHandle *handle,
   if (path != NULL)
     {
       change_folder_and_display_error (impl, path, FALSE);
-      focus_browse_tree_view_if_possible (impl);
       
       gtk_file_path_free (path);
     }
@@ -10399,10 +10381,7 @@ shortcuts_activate_get_info_cb (GtkFileSystemHandle *handle,
     goto out;
 
   if (!error && gtk_file_info_get_is_folder (info))
-    {
-      change_folder_and_display_error (data->impl, data->path, FALSE);
-      focus_browse_tree_view_if_possible (data->impl);
-    }
+    change_folder_and_display_error (data->impl, data->path, FALSE);
   else
     gtk_file_chooser_default_select_path (GTK_FILE_CHOOSER (data->impl),
                                           data->path,
@@ -11248,7 +11227,6 @@ switch_to_shortcut (GtkFileChooserDefault *impl,
     g_assert_not_reached ();
 
   shortcuts_activate_iter (impl, &iter);
-  focus_browse_tree_view_if_possible (impl);
 }
 
 /* Handler for the "home-folder" keybinding signal */